home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 November / november_2001.iso / Browsers / Netscape 6.1 / browser.xpi / bin / chrome / toolkit.jar / content / global / bindings / browser.xml next >
Encoding:
Extensible Markup Language  |  2001-05-12  |  6.9 KB  |  216 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4.    - The contents of this file are subject to the Mozilla Public
  5.    - License Version 1.1 (the "License"); you may not use this file
  6.    - except in compliance with the License. You may obtain a copy of
  7.    - the License at http://www.mozilla.org/MPL/
  8.    -
  9.    - Software distributed under the License is distributed on an "AS
  10.    - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  11.    - implied. See the License for the specific language governing
  12.    - rights and limitations under the License.
  13.    -
  14.    - The Original Code is this file as it was released on
  15.    - March 28, 2001.
  16.    -
  17.    - The Initial Developer of the Original Code is Peter Annema.
  18.    - Portions created by Peter Annema are Copyright (C) 2001
  19.    - Peter Annema.  All Rights Reserved.
  20.    -
  21.    - Contributor(s):
  22.    -   Peter Annema <disttsc@bart.nl> (Original Author)
  23.    -
  24.    - Alternatively, the contents of this file may be used under the
  25.    - terms of the GNU General Public License Version 2 or later (the
  26.    - "GPL"), in which case the provisions of the GPL are applicable
  27.    - instead of those above.  If you wish to allow use of your
  28.    - version of this file only under the terms of the GPL and not to
  29.    - allow others to use your version of this file under the MPL,
  30.    - indicate your decision by deleting the provisions above and
  31.    - replace them with the notice and other provisions required by
  32.    - the GPL.  If you do not delete the provisions above, a recipient
  33.    - may use your version of this file under either the MPL or the
  34.    - GPL.
  35.   -->
  36.  
  37. <bindings id="browserBindings"
  38.           xmlns="http://www.mozilla.org/xbl"
  39.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  40.  
  41.   <binding id="browser" extends="xul:browser">
  42.  
  43.     <implementation type="application/x-javascript">
  44.  
  45.       <property name="canGoBack"
  46.                 onget="return this.webNavigation.canGoBack;"
  47.                 readonly="true"/>
  48.  
  49.       <property name="canGoForward"
  50.                 onget="return this.webNavigation.canGoForward;"
  51.                 readonly="true"/>
  52.  
  53.       <method name="goBack">
  54.         <body>
  55.           <![CDATA[
  56.             var webNavigation = this.webNavigation;
  57.             if (webNavigation.canGoBack)
  58.               webNavigation.goBack();
  59.           ]]>
  60.         </body>
  61.       </method>
  62.  
  63.       <method name="goForward">
  64.         <body>
  65.           <![CDATA[
  66.             var webNavigation = this.webNavigation;
  67.             if (webNavigation.canGoForward)
  68.               webNavigation.goForward();
  69.           ]]>
  70.         </body>
  71.       </method>
  72.  
  73.       <method name="reload">
  74.         <body>
  75.           <![CDATA[
  76.             const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
  77.             const flags = nsIWebNavigation.LOAD_FLAGS_BYPASS_NONE;
  78.             this.reloadWithFlags(flags);
  79.           ]]>
  80.         </body>
  81.       </method>
  82.  
  83.       <method name="reloadWithFlags">
  84.         <parameter name="aFlags"/>
  85.         <body>
  86.           <![CDATA[
  87.             this.webNavigation.reload(aFlags);
  88.           ]]>
  89.         </body>
  90.       </method>
  91.  
  92.       <method name="stop">
  93.         <body>
  94.           <![CDATA[
  95.             this.webNavigation.stop();
  96.           ]]>
  97.         </body>
  98.       </method>
  99.  
  100.       <!-- throws exception for unknown schemes -->
  101.       <method name="loadURI">
  102.         <parameter name="aURI"/>
  103.         <body>
  104.           <![CDATA[
  105.             const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
  106.             const flags = nsIWebNavigation.LOAD_FLAGS_BYPASS_NONE;
  107.             this.loadURIWithFlags(aURI, flags);
  108.           ]]>
  109.         </body>
  110.       </method>
  111.  
  112.       <!-- throws exception for unknown schemes -->
  113.       <method name="loadURIWithFlags">
  114.         <parameter name="aURI"/>
  115.         <parameter name="aFlags"/>
  116.         <body>
  117.           <![CDATA[
  118.             if (!aURI)
  119.               aURI = "about:blank";
  120.  
  121.             this.webNavigation.loadURI(aURI, aFlags);
  122.           ]]>
  123.         </body>
  124.       </method>
  125.  
  126.       <method name="goHome">
  127.         <body>
  128.           <![CDATA[
  129.             try {
  130.               this.loadURI(this.homePage);
  131.             }
  132.             catch (e) {
  133.             }
  134.           ]]>
  135.         </body>
  136.       </method>
  137.  
  138.       <property name="homePage">
  139.         <getter>
  140.           <![CDATA[
  141.             var uri;
  142.  
  143.             if (this.hasAttribute("homepage"))
  144.               uri = this.getAttribute("homepage");
  145.             else
  146.               uri = "http://www.mozilla.org/"; // widget pride
  147.  
  148.             return uri;
  149.           ]]>
  150.         </getter>
  151.         <setter>
  152.           <![CDATA[
  153.             this.setAttribute("homepage", val);
  154.             return val;
  155.           ]]>
  156.         </setter>
  157.       </property>
  158.  
  159.       <method name="gotoIndex">
  160.         <parameter name="aIndex"/>
  161.         <body>
  162.           <![CDATA[
  163.             this.webNavigation.gotoIndex(aIndex);
  164.           ]]>
  165.         </body>
  166.       </method>
  167.  
  168.       <property name="currentURI"
  169.                 onget="return this.webNavigation.currentURI;"
  170.                 readonly="true"/>
  171.  
  172.       <property name="preferences"
  173.                 onget="return Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPref);"
  174.                 readonly="true"/>
  175.  
  176.       <property name="docShell"
  177.                 onget="return this.boxObject.QueryInterface(Components.interfaces.nsIBrowserBoxObject).docShell;"
  178.                 readonly="true"/>
  179.  
  180.       <property name="webNavigation"
  181.                 onget="return this.docShell.QueryInterface(Components.interfaces.nsIWebNavigation);"
  182.                 readonly="true"/>
  183.  
  184.       <property name="webBrowserFind"
  185.                 readonly="true"
  186.                 onget="return this.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebBrowserFind);"/>
  187.  
  188.       <property name="sessionHistory"
  189.                 onget="return this.webNavigation.sessionHistory;"
  190.                 readonly="true"/>
  191.  
  192.       <property name="markupDocumentViewer"
  193.                 onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);"
  194.                 readonly="true"/>
  195.  
  196.       <property name="contentViewerEdit"
  197.                 onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIContentViewerEdit);"
  198.                 readonly="true"/>
  199.  
  200.       <property name="contentViewerFile"
  201.                 onget="return this.docShell.contentViewer.QueryInterface(Components.interfaces.nsIContentViewerFile);"
  202.                 readonly="true"/>
  203.  
  204.       <property name="documentCharsetInfo"
  205.                 onget="return this.docShell.documentCharsetInfo;"
  206.                 readonly="true"/>
  207.  
  208.       <property name="contentDocument"
  209.                 onget="return this.webNavigation.document;"
  210.                 readonly="true"/>
  211.     </implementation>
  212.  
  213.   </binding>
  214.  
  215. </bindings>
  216.